#进制转换

#二进制字符串转为16进制字符串
def tohex(s):
    num = int(s,2)
    return '{:0>2x}'.format(num)

#16进制字符串转为二进制字符串
def hextoBi(s):
    num = int(s,16)
    return '{:0>8b}'.format(num)

def detohex(n):
    return '{:0>2x}'.format(n)

def detoBi(n):
    return '{:0>8b}'.format(n)